<?php
/* @var $this UserController */
/* @var $model User */
/* @var $form CActiveForm */
$this->main_menu = MenuHelper::getArrayForMainMenu(true, false, false);
?>

<?php
$this->widget('bootstrap.widgets.TbTabs', array(
	'type'=>'tabs', // 'tabs' or 'pills'
	'tabs'=>array(
		array('label'=>'Übersicht', 'url'=>$this->createUrl('user/admin'), 'active'=>false),
                array('label'=>'|'),
                array('label'=>'Stammdaten', 'url'=>$this->createUrl('user/update', array('id'=>$model->course_id)), 'active'=>true), 
                array('label'=>'Kurse', 'url'=>$this->createUrl('user/getCourseForUser', array('id'=>$model->user_id)), 'active'=>false),
                array('label'=>'|'),
		array('label'=>'NEU', 'url'=>$this->createUrl('user/create'), 'active'=>false),
	),
));
?>

<?php 
   $salutationArray = $this->modelToArray(Salutation::model()->findAll());
   $partner = $this->modelToArray(Partner::model()->findAll());
   $a = $this->advisorArray(Advisor::model()->findAll());
   $advisor = array(0 => "") + $a;
?>

<?php /** @var BootActiveForm $form */
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array(
	'id'=>'horizontalForm',
	'type'=>'horizontal',
)); ?>
     
<fieldset>

    <?php echo $form->dropDownListRow($model, 'salutation', array_combine($salutationArray, $salutationArray)); ?>
    <?php echo $form->textFieldRow($model, 'title'); ?>
    <?php echo $form->textFieldRow($model, 'first_name'); ?>
    <?php echo $form->textFieldRow($model, 'last_name'); ?>
    <?php echo $form->textFieldRow($model, 'address'); ?>
    <?php echo $form->textFieldRow($model, 'postcode'); ?>
    <?php echo $form->textFieldRow($model, 'place'); ?>
    <?php echo $form->textFieldRow($model, 'tel'); ?>
    <?php echo $form->textFieldRow($model, 'mobile'); ?>
    <?php echo $form->textFieldRow($model, 'email'); ?>
    <?php echo $form->checkBoxRow($model, 'newsletter', array('disabled'=>false)); ?>
    <?php echo $form->dropDownListRow($model, 'educational_partner', array_combine($partner, $partner)); ?>
    <?php echo $form->textAreaRow($model, 'info'); ?>
    <?php echo $form->textFieldRow($model, 'recorded_by'); ?>
    <?php echo $form->textFieldRow($model, 'birthday'); ?>
    <?php echo $form->textFieldRow($model, 'status'); ?>
    <?php echo $form->textFieldRow($model, 'social_security_nr'); ?>

    	<?php
	echo $form->dropDownListRow($model, 'advisor1', array_combine($advisor, $advisor),
	array(
		'ajax' => array(
			'type'=>'POST', //request type
			'url'=>CController::createUrl('user/insertAdvisorEmail'), //url to call.
			'update'=>'#advisor_email', //selector to update
		)
	));   
	?>  

	<div id="advisor_email">		
		<?php echo $form->textFieldRow($model, 'advisor_email'); ?>
	</div> 
    
    <?php echo $form->dropDownListRow($model, 'advisor2', array_combine($advisor, $advisor)); ?>

    <?php echo $form->textFieldRow($model, 'ams_district'); ?>

</fieldset>

     
<div class="form-actions">
    <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'submit', 'type'=>'primary', 'label'=>'Speichern')); ?>
    <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType'=>'reset', 'label'=>'Zurücksetzen')); ?>
</div>
     
<?php $this->endWidget(); ?>





<?php $form=$this->beginWidget('CActiveForm', array(
        'id'=>'user-form',
        'enableAjaxValidation'=>false,
)); ?>
 
<?php
    //show errorsummary at the top for all models
    //build an array of all models to check
    echo $form->errorSummary(array_merge(array($model),$validatedMembers));
?>
 
<div class="row">
    <?php echo $form->labelEx($model,'user_id'); ?>
    <?php echo $form->textField($model,'user_id'); ?>
    <?php echo $form->error($model,'user_id'); ?>
</div>